package flc.ast.adapter;

import android.graphics.Color;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.TimeUtils;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.WeekBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class WeekAdapter extends StkProviderMultiAdapter<WeekBean> {

    public WeekAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(82));
        addItemProvider(new WeekProvider());
    }

    private class WeekProvider extends BaseItemProvider<WeekBean> {

        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_week;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, WeekBean bean) {
            baseViewHolder.setText(R.id.tvWeekItemName, bean.getWeek());
            baseViewHolder.setText(R.id.tvWeekItemNum, bean.getDate());
            if (bean.isSelected()) {
                baseViewHolder.setTextColor(R.id.tvWeekItemName,Color.parseColor("#FFFFFF"));
                baseViewHolder.setImageResource(R.id.ivWeekItemSel, R.drawable.kp_rl2);
            } else {
                baseViewHolder.setTextColor(R.id.tvWeekItemName,Color.parseColor("#CCFFFFFF"));
                baseViewHolder.setImageResource(R.id.ivWeekItemSel, R.drawable.kp_rl);
            }
        }

    }

}
